package com.yinanxi.cool

import org.apache.spark.sql.SparkSession

/**
 * @Created by Orion
 * @Description
 */
object SparkUtils {

  def  getSesion(): SparkSession ={
    /**
     * 解决spark写hive大量小文件问题
     */

    import org.apache.spark.SparkConf
    val conf = new SparkConf
    conf.set("spark.sql.adaptive.enabled", "true")
    conf.set("spark.sql.adaptive.shuffle.targetPostShuffleInputSize", "67108864b")
    conf.set("spark.sql.adaptive.join.enabled", "true")
    conf.set("spark.sql.autoBroadcastJoinThreshold", "20971520")
   SparkSession.builder()
      .master("local[*]")
      .appName(this.getClass.getSimpleName)
      .config(conf)
      .enableHiveSupport()
      .getOrCreate()
  }
}
